import java.nio.file.Paths;
import java.util.ArrayList;

public class main {

	/**
	 * @param args
	 */
	static Node[] nodes;
	static AllLinksAndCosts linksAndCosts;
	static ArrayList<Integer> settledNodes = new ArrayList<Integer>();
	static ArrayList<Integer> unsettledNodes = new ArrayList<Integer>();
	
	
	public static void main(String[] args) {	
		linksAndCosts = new AllLinksAndCosts();
		nodes = new Node[linksAndCosts.numberOfNodes];
		
		algorithm(linksAndCosts, 1);
		
	}
	
	private static void algorithm(AllLinksAndCosts linksAndCosts, int sourceNode) {
		unsettledNodes.add(sourceNode);
		Integer evaluationNode;
		
		linksAndCosts.links[sourceNode].metricFromSource = 0;
		
		while (unsettledNodes.size() > 0) {
			evaluationNode = getNodeWithLowestDistance(unsettledNodes);
			unsettledNodes.remove(evaluationNode);
			settledNodes.add(evaluationNode);
			evaluateNeighbors(evaluationNode);
		}
		
		
	}
	
	private static int getNodeWithLowestDistance(ArrayList<Integer> unsettledNodes) {
		int tempNode = unsettledNodes.get(0);
		for (int x = 0; x < unsettledNodes.size(); x++) {
			if (unsettledNodes.get(x) < tempNode) {
				tempNode = unsettledNodes.get(x);
			}
		}
		return tempNode;
	}
	
	private static void evaluateNeighbors(Integer evaluationNode) {
		ArrayList<Integer> edgeDestinationNodes = new ArrayList<Integer>();
		for (int x = 0; x < settledNodes.size(); x++) {
			
		}
	}
//	private static void algorithm(AllLinksAndCosts linksAndCosts) {
//		//TODO
//		int numberOfNodes = linksAndCosts.numberOfNodes;
//		int numberOfLinks = linksAndCosts.numberOfLinks;
//		int tempNode = 1;
//		float tempNodeMetric = 0;
//		
//		nodes[0] = new Node(tempNode, numberOfNodes);
//		Node currentNode = nodes[0];
//		
//		//currentNode.addShortestPath(currentNode.nodeValue, 0);
//		
//		for (int k=0; k < numberOfLinks; k++) {
//			Link currentLink = linksAndCosts.links[k];
//			if (currentLink.source == currentNode.nodeValue) {
//				//If tempNodeCost is 0 it means it hasn't been set yet and we should take the value
//				if (tempNodeMetric == 0 || currentLink.metric < tempNodeMetric) {
//					tempNodeMetric = currentLink.metric;
//					tempNode = currentLink.destination;
//				}
//			}
//		}
//		currentNode.addShortestPath(tempNode, tempNodeMetric);
//		
//		tempNodeMetric = 0;
//		
//		while(true) {
//			for (int shortestPathIndex = 0; shortestPathIndex < currentNode.paths.length; shortestPathIndex++)
//			{
//				for (int k=0; k < numberOfLinks; k++) {
//					//Only one of the following if statements will be true
//					if (currentNode.paths[shortestPathIndex].destination == linksAndCosts.links[k].source) {
//						if (tempNodeMetric == 0 || linksAndCosts.links[k].metric + currentNode.paths[shortestPathIndex].metric < 
//								tempNodeMetric) {
//							
//							tempNodeMetric = linksAndCosts.links[k].metric + currentNode.paths[shortestPathIndex].metric;
//							//For loop to see if we already have that shortest path
//							for (int shortestPathIndex)
//							tempNode = linksAndCosts.links[k].source;
//						}
//						
//					}
//					else if (currentNode.paths[shortestPathIndex].destination == linksAndCosts.links[k].destination) {
//						if (tempNodeMetric == 0 || linksAndCosts.links[k].metric + currentNode.paths[shortestPathIndex].metric < 
//								tempNodeMetric) {
//							tempNodeMetric = linksAndCosts.links[k].metric + currentNode.paths[shortestPathIndex].metric;
//							tempNode = linksAndCosts.links[k].destination;
//						}
//					}
//				}
//			}
//			currentNode.addShortestPath(tempNode, tempNodeMetric);
//		}	
//	}

}
